﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using ListenMusic.Models.Reposistory.Public;
using ListenMusic.Models.ViewModel;
using System.ServiceModel;
namespace ListenMusic.Controllers.Public
{
    public class AlbumController : ApplicationController
    {
        //
        // GET: /Album/
       
        public AlbumController()
        {
           
        }
        public ActionResult getAllAlbum(int pageindex,int categoryid)
        {
            try
            {
                int pagesize = 7;
                int start = (pageindex - 1) * pagesize;
                int end = pageindex*pagesize;
                double a = _album.countAlbum_byCategoryID(categoryid) / pagesize;
                ViewBag.totalAlbum = Math.Ceiling(a) + 1;
                ViewBag.allAlbum = _album.getAllAlbum_byCategoryID(start,end,categoryid);
                return View("AllAlbum");
            }
            catch (FaultException ex)
            {
                throw ex;
            }
        }
        public ActionResult getRangeAlbum(int countryid)
        {
            try
            {
                ViewBag.rangeAlbum = _album.getRange_Album_byCountryid(countryid);
                return View("RangeAlbum");
            }
            catch (FaultException ex)
            {
                throw ex;
            }
        }
    }
}
